var storage = {
    set: function(key, value) {
        if (this.isLocalStorage()) {
            window.localStorage.setItem(key, value);
        } else {
            $.cookie(key, value);
        }
    },
    get: function(key) {
        if (this.isLocalStorage()) {
            return window.localStorage.getItem(key);
        } else {
            return $.cookie(key);
        }
    },
    remove: function(key) {
        if (this.isLocalStorage()) {
            window.localStorage.removeItem(key);
        } else {
            $.cookie(key, null);
        }
    },
    isLocalStorage: function() {
        try {
            return window.localStorage !== undefined && window.localStorage !== null;
        } catch (e) {
            return false;
        }
    }
};

/** 设置主题 */
var skin = storage.get("skin");
if (skin === null || skin === undefined) {
    // 恢复默认设置，不再强制设置黑色主题
    storage.remove('skin');
} else {
    var skins = skin.split('|');
    $("body").addClass(skins[0] + " " + skins[1]);
} 